'use strict';

const BaseService = require('./base');

class InsuranceCoverageService extends BaseService {
  constructor(ctx) {
    super(ctx, 'InsuranceCoverage');
  }
  
  // 重写allList方法，添加保险公司关联查询
  async allList(where) {
    return this.ctx.model.InsuranceCoverage.findAll({
      where,
      order: this.listOrder() || [],
      include: [{
        model: this.ctx.model.InsuranceCompany,
        as: 'insuranceCompany',
        attributes: ['id', 'company_name']
      }]
    });
  }
}

module.exports = InsuranceCoverageService;
